//
//  TabBaseViewController.m
//  DaJiang
//
//  Created by sally on 16/9/29.
//  Copyright © 2016年 jiniu. All rights reserved.
//

#import "FinishInfoViewController.h"
#import "LoginViewController.h"
#import "TabBaseViewController.h"
#import "TabThreeViewController.h"
#import "TabTwoViewController.h"

@interface TabBaseViewController ()

@end

@implementation TabBaseViewController

- (void)viewDidLoad {
  [super viewDidLoad];
  [[UINavigationBar appearance] setTranslucent:NO];
  [[UINavigationBar appearance] setTitleTextAttributes:@{NSFontAttributeName : [UIFont systemFontOfSize:GLargeFontSize], NSForegroundColorAttributeName : GBlackColor}];
  [[UINavigationBar appearance] setTintColor:GGrayWordColor2];
}

- (void)viewDidAppear:(BOOL)animated {
  UserModel *userModel = [[CacheManager shareInstance] getLastLoginAccount];
  if (userModel) {
    if (!userModel.user_data.user_name || !userModel.user_data.user_profile_pic || userModel.user_data.user_name.length < 1 || userModel.user_data.user_profile_pic.length < 1) {
      FinishInfoViewController *vc = [[FinishInfoViewController alloc] init];
      vc.isHiddenBack = YES;
      vc.hidesBottomBarWhenPushed = YES;
      [[[CommonMethod sharedCommonMethod] getCurrNavController] pushViewController:vc animated:YES];
    }
  } else {
    UIViewController *rootVC = [self.navigationController.viewControllers objectAtIndex:0];
    if ([rootVC isKindOfClass:[TabTwoViewController class]] || [rootVC isKindOfClass:[TabThreeViewController class]]) {
      [OperationManager gotoLogin];
    }
  }
}

@end
